//设备相关的接口函数放在这里
import request from "@/utils/request";
// 枚举定义接口地址
enum API {
  COUNT = '/dashboard/count',  //获取终端信息计数器

  DEVICES = "/terminal", //获取所有设备的卡片式综合数据

  TEMPLATE = "/template", //获取指定设备的隶属模板信息

  DEVICE = "/dashboard", //获取设备的卡片式综合数据

  LASTPRODEVENT = "prodevent/last/", // 获取根据设备序列号查询最后一条生产事件信息

  BASIC = "/basic",  //通信交互基本服务控制器

  CHANGED = "/changed",  //通信交互换产服务控制器

  TERMINAL = "/terminal",  //获取所有终端信息

  EXPORTINFO = "/terminal/export/",  //导出终端信息配置文件
}

//获取终端信息计数器
export const reqCount = () => request.get<any, any>(API.COUNT);

//获取所有设备的卡片式综合数据
export const reqdevices = () => request.get<any, any>(API.DEVICES);

//获取指定设备的隶属模板信息
export const reqtemplate = (TerminalIdentity: any) => request.get<any, any>(API.TEMPLATE + `/${TerminalIdentity}`);

//获取设备的卡片式综合数据
export const reqdevice = (TerminalIdentity: any) => request.get<any, any>(API.DEVICE + `/${TerminalIdentity}`);

// 获取根据设备序列号查询最后一条生产事件信息
export const reqLastProdevent = (TerminalIdentity: any) => request.get<any, any>(API.LASTPRODEVENT + `${TerminalIdentity}`);

//通信交互基本服务控制器
export const reqBasic = (data: any) => request.post<any, any>(API.BASIC, data);

//通信交互换产服务控制器
export const reqChanged = (data: any) => request.post<any, any>(API.CHANGED, data);

//获取所有终端信息
export const reqTerminal = () => request.get<any, any>(API.TERMINAL);

//导出终端信息配置文件
export const reqExport = (terminalId: any) => request.get<any, any>(API.EXPORTINFO + `${terminalId}`);
